package com.jlsoft;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@EnableOAuth2Sso
@Slf4j
public class SsoClientBApplication {

    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(SsoClientBApplication.class);
        application.setBannerMode(Banner.Mode.OFF);
        application.run(args);

    }

    @GetMapping("/user")
    public Authentication getCurrentUser (Authentication authorization) {

        return authorization;
    }
}
